package pa2.node;

import java.rmi.RemoteException;
import java.util.Map;

import pa2.system.Peer;
import pa2.util.EqualityCompare;

public class NetworkNodeFactory extends NodeFactoryDecorator {

	private Peer[] partnerPeers;
	
	public NetworkNodeFactory(NodeFactory decoratedNodeFactory, Peer[] partnerPeers) {
		super(decoratedNodeFactory);
		this.partnerPeers = partnerPeers;
	}

	@Override
	public <K extends EqualityCompare<K>, V, M extends Map<K, V>> Node<K, V, M> createNode(
			K key, NodeData<K, V, M> data) throws RemoteException {
		return new NetworkNode<K,V,M>(super.createNode(key, data), this.partnerPeers);
	}

	@Override
	public <K extends EqualityCompare<K>, V, M extends Map<K, V>> void destroyNode(
			Node<K, V, M> node) throws RemoteException {
		// TODO destroy NetworkNode
		super.destroyNode(node);
	}

	
}
